package com.hl.sfzy.controller;

import com.hl.sfzy.entity.HeartMark;
import com.hl.sfzy.service.HeartMarkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;  // 添加这行
import java.util.Map;

@RestController
@RequestMapping("/api/my/assessment")
public class MyAssessmentController1 {
    @Autowired
    private HeartMarkService heartMarkService;

    @GetMapping("/getAssessments")
    public ResponseEntity<Map<String, Object>> getAssessments(@RequestParam Integer userId,
                                                              @RequestParam Integer pageNo,
                                                              @RequestParam Integer pageSize) {
        List<HeartMark> assessments = heartMarkService.getAssessmentsByUserId(userId, pageNo, pageSize);

        Map<String, Object> response = new HashMap<>();
        response.put("assessments", assessments);
        return ResponseEntity.ok(response);
    }
}